home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
prodpack.zip
/
DB4PPSRC.EXE
/
_STRINBO.PRG
< prev
next >
Wrap
Text File
|
1993-05-04
|
2KB
|
85 lines
FUNCTION _StrInBox
PARAMETERS pn_row, pn_col, pc_prompt, pc_str, pn_maxlen, pn_scroll
*---------------------------------------------------------------------
* NAME
* _StrInBox - Get a string in a box
*
* DESCRIPTION
* This routine implements the fill-in popup to get a string
* from the user. The box dimensions are determined on the
* fly depending upon the prompt length and the scroll_len.
* The height of the box is assumed to be 3.
*
* If an error is encountered during processing, that error is displayed
* with a beep and we return -1 with the original string value
* remaining unchanged. If the user hits ESCAPE key then also -1
* is returned (without changing the original string value) and the
* caller should take appropriate action (may be no action).
*
*
* SYNOPSIS
*
* PARAMETERS
* pn_row = Top row position
* pn_col = Left column position
* pc_prompt = Prompt inside of the box
* pc_str = Starting value
* pn_maxlen = Maximum length of the string
* pn_scroll = Scroll length for the input string
*
* LIMITATIONS
*
* DEPENDENCIES
*
*---------------------------------------------------------------------
PRIVATE ll_deli, lc_str, lc_pict, ll_confirm, ln_rtn, ln_inboxw, ;
ln_getcol, lc_window
ll_deli = SET("DELIMITER") = "ON"
SET DELIMITER OFF
ll_confirm = SET("CONFIRM") = "ON"
SET CONFIRM ON
lc_window = WINDOW()
ln_inboxw = LEN( pc_prompt ) + 3 + pn_scroll
lc_str = pc_str + SPACE( pn_maxlen - LEN( pc_str ) )
DEFINE WINDOW StrInBox FROM pn_row, pn_col ;
TO pn_row+2, pn_col+ln_inboxw+1 DOUBLE
ACTIVATE WINDOW StrInBox
@ 0,0 SAY [ ] + pc_prompt + [ ]
lc_pict = "@S" + LTRIM( STR( pn_scroll, 3 ) )
ln_getcol = ln_inboxw - pn_scroll
ln_rtn = 0
DO WHILE .T.
@ 0, ln_getcol GET lc_str PICTURE ( lc_pict )
DO _Read_It
ln_lastkey = LASTKEY()
IF ln_lastkey = 27
ln_rtn = -1
ELSE
pc_str = lc_str
ENDIF
EXIT
ENDDO
IF ll_deli
SET DELIMITER ON
ENDIF
IF .NOT. ll_confirm
SET CONFIRM OFF
ENDIF
SET CURSOR ON
RELEASE WINDOW StrInBox
IF .NOT. ISBLANK( lc_window )
ACTIVATE WINDOW &lc_window
ENDIF
RETURN( ln_rtn )
*-- EOF: _StrInBox( pn_row, pn_col, pc_prompt, pc_str, pn_max, pn_scroll )